package cn.qidisoft.edu.hzjt.controller.xb;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.converters.DateConverter;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.endpoint.Client;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import cn.qidisoft.core.common.context.ApplicationContextConfigUtil;
import cn.qidisoft.core.common.log.LoggerAdapter;
import cn.qidisoft.core.common.log.LoggerAdapterFactory;
import cn.qidisoft.core.common.pagination.Page;
import cn.qidisoft.core.common.pagination.PaginationBean;
import cn.qidisoft.core.util.DateUtil;
import cn.qidisoft.core.util.file.FileUtil;
import cn.qidisoft.core.util.json.JsonBinder;
import cn.qidisoft.core.util.moffice.excel.ExpExcelUtil;
import cn.qidisoft.core.util.uuid.UUIDGenerator;
import cn.qidisoft.edu.hzjt.annotation.SysLogger;
import cn.qidisoft.edu.hzjt.constants.Constant;
import cn.qidisoft.edu.hzjt.controller.BaseController;
import cn.qidisoft.edu.hzjt.exception.RPCException;
import cn.qidisoft.edu.hzjt.model.BjxxClassMaterialFile;
import cn.qidisoft.edu.hzjt.model.ResponseResult;
import cn.qidisoft.edu.hzjt.model.UserEmployee;
import cn.qidisoft.edu.hzjt.model.xb.PartyIncorruptEn;
import cn.qidisoft.edu.hzjt.model.xb.WindUpStudyAttEn;
import cn.qidisoft.edu.hzjt.model.xb.WindUpStudyEn;
import cn.qidisoft.edu.hzjt.service.xb.IWindUpStudyAttService;
import cn.qidisoft.edu.hzjt.service.xb.IWindUpStudyService;
import cn.qidisoft.edu.hzjt.utils.AddSoapHeader;
import cn.qidisoft.edu.hzjt.utils.CommonUtils;
import cn.qidisoft.edu.hzjt.utils.LogType;
import cn.qidisoft.edu.hzjt.utils.WsClientUrlConstants;
import cn.qidisoft.edu.hzjt.vo.FlowApprovalState;

/**
 * 
 * @ClassName: WindUpStudyController   
 * @Description: 结业申请  JKY_JYPX_JESQ
 * @author admin   
 * @date 2018年11月29日   
 *
 */
@Controller
@RequestMapping(value = "/windUpStudy")
public class WindUpStudyController {

    protected static final LoggerAdapter LOGGER = LoggerAdapterFactory
        .getLogger(LogType.HZJT_LOGGER.val);

    private static String                upload = null;
    static {
        upload = ApplicationContextConfigUtil.getString("file.path", null);
    }

    private static Map<String, List<WindUpStudyAttEn>> picMap = new HashMap<>();

    @Autowired
    private IWindUpStudyService                        service;

    @Autowired
    private IWindUpStudyAttService                     WindUpStudyAttrService;

    @RequestMapping(value = "/index")
    public String index(ModelMap model, HttpServletRequest request) {
        request.setAttribute("msg", BaseController.getParameter("msg"));
        BaseController.removeParameter("msg");

        //获取年份list
        List<Map<String, Object>> yearList = service.queryAllYearList();
        request.setAttribute("yearList", yearList);

        return "xb/JKY_JYPX_JESQ/list_WindUpStudy";
    }

    @RequestMapping(value = "/list")
    @ResponseBody
    public ResponseResult list(ModelMap model, HttpServletRequest request,
                               @RequestParam(value = "rows", required = false) String pageSize,
                               @RequestParam(value = "page", required = false) String currentPage,
                               WindUpStudyEn data) {
        try {
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            data.setEmpId(userEmployee.getEmid());
            data.setgID(UUIDGenerator.genReqID());
            Page page = new Page();
            page.setCurrPage(currentPage == null ? 0 : Integer.valueOf(currentPage));
            page.setPageSize(pageSize == null ? Constant.PageSize : Integer.valueOf(pageSize));
            BaseController.setSortByColumn(request, "createtime", "desc");
            data.setOrderField((String) request.getAttribute("orderField"));
            data.setOrderFlag((String) request.getAttribute("orderFlag"));
            PaginationBean<WindUpStudyEn> paginationBean = service.queryPageList(data, page);
            ResponseResult result = new ResponseResult();
            result.setTotal(paginationBean.getTotalRecords());
            result.setRows(paginationBean.getPageList());
            return result;
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return null;
    }

    /**
     * 
     * @Title: add   
     * @Description: 详情页面
     * 1、点击标题的超链接直接看详情
     * 2、新增页面点击“保存”按钮跳转
     * @param @param model
     * @param @param request
     * @param @return    参数   
     * @return String    返回类型   
     * @throws
     */
    @RequestMapping(value = "/info", method = RequestMethod.GET)
    public String info(ModelMap model, HttpServletRequest request) {
        try {
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            model.addAttribute("emid", userEmployee.getEmid());
            model.addAttribute("xm", userEmployee.getXm());
            model.addAttribute("zgh", userEmployee.getZgh());

            //获取详情
            String id = request.getParameter("id") == null ? "0" : request.getParameter("id");
            String gid = request.getParameter("gid");
            WindUpStudyEn WindUpStudyEn = new WindUpStudyEn();
            WindUpStudyEn.setJyId(Integer.parseInt(id));
            WindUpStudyEn.setgID(gid);

            WindUpStudyEn entityInfo = service.queryByPK(WindUpStudyEn);
            model.addAttribute("entity", entityInfo);

            //获取附件信息
            WindUpStudyAttEn att = new WindUpStudyAttEn();
            att.setParentId(entityInfo.getJyId());
            List<WindUpStudyAttEn> attList = WindUpStudyAttrService.queryList(att);
            model.addAttribute("dataList", attList);

            request.setAttribute("msg", BaseController.getParameter("msg"));
            BaseController.removeParameter("msg");

            //获取审批流程记录信息
            List<WindUpStudyEn> chekResultList = new ArrayList<WindUpStudyEn>();
            if (entityInfo != null && !entityInfo.getStates()
                .equals(String.valueOf(FlowApprovalState.state0.getIndex()))) {
                // 审批流程记录信息
                Client client = AddSoapHeader.validateClient(
                    WsClientUrlConstants.WS_FLOW_FACADE_REMOTE, userEmployee.getUserid());
                if (client != null) {
                    Object[] object = new Object[] { id + "",
                                                     WsClientUrlConstants.JYGL_JYSQ_JYSQSP_CELL_ID,
                                                     true };
                    Object[] results = client.invoke("GetCustomAuditResults", object);
                    if (results != null && results.length >= 1) {
                        JSONObject jsonObject = (JSONObject) JSON.parse((String) results[0]);
                        if (jsonObject.get("data") != null) {
                            chekResultList = JSON.parseArray(jsonObject.get("data").toString(),
                                WindUpStudyEn.class);
                        }
                    }
                }
            }
            model.put("chekResultList", chekResultList);
        } catch (Exception e) {
            e.printStackTrace();

            LOGGER.error("查询 queryByPK [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }

        return "xb/JKY_JYPX_JESQ/info_WindUpStudy";
    }

    /**
     * 
     * @Title: add   
     * @Description: 详情页面
     * 1、点击标题的超链接直接看详情
     * 2、新增页面点击“保存”按钮跳转
     * @param @param model
     * @param @param request
     * @param @return    参数   
     * @return String    返回类型   
     * @throws
     */
    @RequestMapping(value = "/info2", method = RequestMethod.GET)
    public String info2(ModelMap model, HttpServletRequest request) {
        try {
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            model.addAttribute("emid", userEmployee.getEmid());
            model.addAttribute("xm", userEmployee.getXm());
            model.addAttribute("zgh", userEmployee.getZgh());

            //获取详情
            String id = request.getParameter("id") == null ? "0" : request.getParameter("id");
            String gid = request.getParameter("gid");
            WindUpStudyEn WindUpStudyEn = new WindUpStudyEn();
            WindUpStudyEn.setJyId(Integer.parseInt(id));
            WindUpStudyEn.setgID(gid);

            WindUpStudyEn entityInfo = service.queryByPK(WindUpStudyEn);
            model.addAttribute("entity", entityInfo);

            //获取附件信息
            WindUpStudyAttEn att = new WindUpStudyAttEn();
            att.setParentId(entityInfo.getJyId());
            List<WindUpStudyAttEn> attList = WindUpStudyAttrService.queryList(att);
            model.addAttribute("dataList", attList);

            request.setAttribute("msg", BaseController.getParameter("msg"));
            BaseController.removeParameter("msg");
        } catch (Exception e) {
            e.printStackTrace();

            LOGGER.error("查询 queryByPK [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }

        return "xb/JKY_JYPX_JESQ/info_WindUpStudyByManage";
    }

    @RequestMapping(value = "/addInInt", method = RequestMethod.GET)
    public String add(ModelMap model, HttpServletRequest request) {
        try {
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            model.addAttribute("emid", userEmployee.getEmid());
            model.addAttribute("xm", userEmployee.getXm());
            model.addAttribute("zgh", userEmployee.getZgh());

            Map<String, Object> deptAndOrg = service
                .queryUserDeptAndOrg(userEmployee.getEmid().intValue());
            model.addAttribute("deptAndOrg", deptAndOrg);

            WindUpStudyEn entityInfo = new WindUpStudyEn();
            //获取详情
            String id = request.getParameter("id");
            if (!StringUtils.isEmpty(id)) {
                WindUpStudyEn WindUpStudyEn = new WindUpStudyEn();
                WindUpStudyEn.setJyId(Integer.parseInt(id));
                entityInfo = service.queryByPK(WindUpStudyEn);

                //获取附件信息
                WindUpStudyAttEn att = new WindUpStudyAttEn();
                att.setParentId(WindUpStudyEn.getJyId());
                List<WindUpStudyAttEn> attList = WindUpStudyAttrService.queryList(att);
                model.addAttribute("dataList", attList);
            }
            model.addAttribute("entity", entityInfo);

            request.setAttribute("msg", BaseController.getParameter("msg"));
            BaseController.removeParameter("msg");
        } catch (Exception e) {
            e.printStackTrace();
        }

        return "xb/JKY_JYPX_JESQ/modify_WindUpStudy";
    }

    @SysLogger(description = "结业申请管理信息", moduleName = "结业申请管理", method = "新增保存")
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public String save(HttpServletRequest request, WindUpStudyEn data) {
        try {
            String type = request.getParameter("urlTp");//1#add保存（跳转info）|2#add保存并新增（跳转addInInt）|3#modify保存（跳转列表index）
            if (StringUtils.isEmpty(type)) {
                BaseController.setParameter("msg", "参数type丢失");
                return "redirect:index";
            }

            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            String gid = UUIDGenerator.genReqID();
            data.setgID(gid);
            data.setCreateTime(DateUtil.formatDate2Str((new Date()), DateUtil.YYYY_MM_DD_FORMAT));

            if (data.getJyId() != 0) {
                WindUpStudyEn newData = new WindUpStudyEn();
                ConvertUtils.register(new DateConverter(null), java.util.Date.class);
                BeanUtils.copyProperties(newData, data);

                service.update(newData);

                BaseController.setParameter("msg", "修改成功");
            } else {
                service.insert(data);

                BaseController.setParameter("msg", "添加成功");

                //这里还是要查询下，得到id
                WindUpStudyEn queryData = service.queryByPK(data);
                data.setJyId(queryData.getJyId());
            }

            String path = upload;
            List<WindUpStudyAttEn> docFileResourceList = picMap
                .get(String.valueOf(userEmployee.getUserid()));
            if (docFileResourceList != null && !docFileResourceList.isEmpty()) {
                MultipartFile file = null;
                String filePath = CommonUtils.createSaveFilePath("JKY_JYPX_JESQ",
                    userEmployee.getUserid());
                for (WindUpStudyAttEn r : docFileResourceList) {
                    file = r.getMufile();
                    r.setParentId(data.getJyId());
                    String name = file.getOriginalFilename();// 获取上传文件名
                    InputStream in = r.getInputStream();// 获取文件对象
                    int pos = name.lastIndexOf(".");
                    String lastname = name.substring(pos, name.length());
                    // 文件保存的路径
                    String savePath = path + CommonUtils.fileSeprator+ filePath;
                    FileUtil.saveFile(savePath, in, r.getGid() + lastname);
                    r.setGid(r.getGid());// 附件id
                    r.setFileName(name);
                    r.setParentId(data.getJyId());
                }
                WindUpStudyAttrService.batchInserts(docFileResourceList);
                //一旦上传成功需要清空，否则下一次上传的时候又刚一遍了~
                picMap.remove(String.valueOf(userEmployee.getUserid()));
            }

            if ("1".equals(type)) {
                return "redirect:info?gid=" + data.getgID() + "&id=" + data.getJyId();//1#add保存（跳转info）
            } else if ("2".equals(type)) {
                return "redirect:addInInt";//2#add保存并新增（跳转addInInt）
            } else if ("3".equals(type)) {
                return "redirect:index";//3#modify保存（跳转列表index）
            } else {
                BaseController.setParameter("msg", "参数非法");
                return "redirect:index";
            }

        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("添加信息 add [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            return "error/error";
        }
    }

    @RequestMapping(value = "/save2Audit", method = RequestMethod.GET)
    public String save2Audit(HttpServletRequest request) {
        try {
            //获取详情
            String id = request.getParameter("id") == null ? "0" : request.getParameter("id");
            String gid = request.getParameter("gid");
            WindUpStudyEn WindUpStudyEn = new WindUpStudyEn();
            WindUpStudyEn.setJyId(Integer.parseInt(id));
            WindUpStudyEn.setgID(gid);

            WindUpStudyEn entityInfo = service.queryByPK(WindUpStudyEn);

            WindUpStudyEn newData = new WindUpStudyEn();
            ConvertUtils.register(new DateConverter(null), java.util.Date.class);
            BeanUtils.copyProperties(newData, entityInfo);
            newData.setStates("2");

            service.update(newData);

            BaseController.setParameter("msg", "提交成功");

            return "redirect:index";//3#modify保存（跳转列表index）
        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("添加信息 add [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            return "error/error";
        }
    }

    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public String delete(ModelMap model, HttpServletRequest request) {
        try {
            String[] idList = request.getParameter("idList").split(",");
            for (int i = 0; i < idList.length; i++) {
                WindUpStudyEn data = new WindUpStudyEn();
                data.setJyId(Integer.parseInt(idList[i]));
                service.delete(data);
            }

            BaseController.setParameter("msg", "删除成功");
            return "redirect:index";
        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("删除 delete [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            return "error/error";
        }
    }

    /**
     * 
     * @Title: loadFile   
     * @Description: 附件上传
     * @param @param file
     * @param @param request
     * @param @param response    参数   
     * @return void    返回类型   
     * @throws
     */
    @RequestMapping(value = "/source_upload", method = RequestMethod.POST)
    public @ResponseBody void source_upload(@RequestParam("file") MultipartFile file,
                                            HttpServletRequest request,
                                            HttpServletResponse response) {
        List<WindUpStudyAttEn> list = new ArrayList<>();
        UserEmployee userEmployee = (UserEmployee) request.getSession()
            .getAttribute(Constant.LOGIN_CONSOLE_USER);
        List<WindUpStudyAttEn> docFileResourceList = picMap
            .get(String.valueOf(userEmployee.getUserid()));
        // 本地env配置路径
        String path = upload;
        try {
            String gid = UUID.randomUUID().toString();
            String name = file.getOriginalFilename();// 获取上传文件名
            // 获取文件后缀名称
            String extend = FilenameUtils.getExtension(name);
            WindUpStudyAttEn docFile = new WindUpStudyAttEn();
            String filePath = CommonUtils.createSaveFilePath("JKY_JYPX_JESQ",
                userEmployee.getUserid());
            if (!file.isEmpty()) {
                // 文件的大小
                docFile.setFileSize(
                    String.valueOf(FileUtil.FormetFileSize(Long.valueOf(file.getSize()))));
                docFile.setFileName(name);
                docFile.setGid(gid);
                docFile.setExtension(FileUtil.getFileExtendName(name).toLowerCase());
                docFile.setMufile(file);
                docFile.setInputStream(file.getInputStream());
                /**
                 * 2018年12月9日 
                 * 当前业务目录/用户ID/上传当前时间（到天）/随机生成uuid文件名称
                 */
                docFile.setFilePath(filePath + gid + "." + extend);
                docFile.setSysfilepath(path + CommonUtils.fileSeprator+ filePath + gid + "." + extend);
                docFile.setOrders(0);
                if (docFileResourceList != null && docFileResourceList.size() > 0) {
                    docFileResourceList.add(docFile);
                    picMap.put(String.valueOf(userEmployee.getUserid()), docFileResourceList);
                } else {
                    list.add(docFile);
                    picMap.put(String.valueOf(userEmployee.getUserid()), list);
                }
                LOGGER.info("附件上传成功！");
            }
            PrintWriter writer = null;
            BjxxClassMaterialFile docFile2 = new BjxxClassMaterialFile();
            docFile2.setFilepath(docFile.getFilePath());
            // 文件名称
            docFile2.setFilename(docFile.getFileName());
            docFile2.setSysfilepath(path + CommonUtils.fileSeprator+ filePath + gid + "." + extend);
            writer = response.getWriter();
            String json = JSONObject.toJSONString(docFile2);
            writer.write(json);
            writer.flush();
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * 
     * @Title: source_upload_update   
     * @Description: 删除附件
     * @param @param fileId
     * @param @param request
     * @param @param response
     * @param @return    参数   
     * @return Map<String,Object>    返回类型   
     * @throws
     */
    @RequestMapping(value = "/source_upload_update", method = RequestMethod.POST)
    public @ResponseBody Map<String, Object> source_upload_update(@RequestParam("fileId") String fileId,
                                                                  @RequestParam("filePath") String filePath,
                                                                  HttpServletRequest request,
                                                                  HttpServletResponse response) {
        Map<String, Object> dataMap = new HashMap<String, Object>();
        try {
            //删除表记录
            WindUpStudyAttEn attEntity = new WindUpStudyAttEn();
            attEntity.setFileId(Integer.parseInt(fileId));

            WindUpStudyAttEn newAttEntity = WindUpStudyAttrService.queryByFileId(attEntity);
            filePath = newAttEntity.getFilePath();
            WindUpStudyAttrService.delete(attEntity);

            //删除原始文件
            File file = new File(upload + CommonUtils.fileSeprator+ filePath);
            file.delete();

            //删除目录：实际上是删除最后一节也就是日期文件夹
            try {
                FileUtils.forceDelete(new File(
                    upload + CommonUtils.fileSeprator+ filePath.substring(0, filePath.lastIndexOf("\\")))); //如果文件中所有的文件被删除了，还需要删除文件目录
            } catch (Exception e) {

            }

            dataMap.put("success", "0000");
        } catch (Exception e) {
            LOGGER.error("调用services网络异常", e);
            dataMap.put("success", "-9999");
        }
        return dataMap;
    }

    /******************************************************************华丽的分隔符********************************************************************************/
    /**
     * 
     * @Title: index   
     * @Description: 审批Grid页面
     * @param @param model
     * @param @param request
     * @param @return    参数   
     * @return String    返回类型   
     * @throws
     */
    @RequestMapping(value = "/index_manage")
    public String index_audit(ModelMap model, HttpServletRequest request) {
        request.setAttribute("msg", BaseController.getParameter("msg"));
        BaseController.removeParameter("msg");

        //获取年份list
        List<Map<String, Object>> yearList = service.queryAllYearList();
        request.setAttribute("yearList", yearList);

        //获取部门list
        List<Map<String, Object>> deptList = service.queryAllDeptList();
        request.setAttribute("deptList", deptList);

        //获取组织list
        List<Map<String, Object>> orgList = service.queryAllOrgList();
        request.setAttribute("orgList", orgList);
        return "xb/JKY_JYPX_JESQ/list_WindUpStudyByManage";
    }

    /*  @RequestMapping(value = "/list_manage")
    @ResponseBody
    public ResponseResult list_audit(ModelMap model, HttpServletRequest request,
                                     @RequestParam(value = "rows", required = false) String pageSize,
                                     @RequestParam(value = "page", required = false) String currentPage) {
        try {
            Map<String, Object> map = new HashMap<>();
            String ksId = request.getParameter("ksId");
            if (!StringUtils.isEmpty(ksId)) {
                map.put("ksId", ksId);
            }
    
            String tgId = request.getParameter("tgId");
            if (!StringUtils.isEmpty(tgId)) {
                map.put("tgId", tgId);
            }
    
            String empId = request.getParameter("empId");
            if (!StringUtils.isEmpty(empId)) {
                map.put("empId", empId);
            }
    
            String xm = request.getParameter("xm");
            if (!StringUtils.isEmpty(xm)) {
                map.put("xm", xm.trim());
            }
    
            String jyNf = request.getParameter("jyNf");
            if (!StringUtils.isEmpty(jyNf)) {
                map.put("jyNf", jyNf);
            }
    
            String states = request.getParameter("states");
            if (!StringUtils.isEmpty(states)) {
                map.put("states", states);
            }
    
            String startTime = request.getParameter("startTime");
            if (!StringUtils.isEmpty(startTime)) {
                map.put("startTime", startTime);
            }
    
            String endTime = request.getParameter("endTime");
            if (!StringUtils.isEmpty(endTime)) {
                map.put("endTime", endTime);
            }
    
            Page page = new Page();
            page.setCurrPage(currentPage == null ? 0 : Integer.valueOf(currentPage));
            page.setPageSize(pageSize == null ? Constant.PageSize : Integer.valueOf(pageSize));
            BaseController.setSortByColumn(request, "createtime", "desc");
            map.put("orderField", (String) request.getAttribute("orderField"));
            map.put("orderFlag", (String) request.getAttribute("orderFlag"));
            PaginationBean<Map<String, Object>> paginationBean = service.queryUserAllAuditData(map,
                page);
            ResponseResult result = new ResponseResult();
            result.setTotal(paginationBean.getTotalRecords());
            result.setRows(paginationBean.getPageList());
            return result;
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return null;
    }*/

    /**
     * 审批流程列表详情
     * 
     * @param model
     * @param request
     * @param id
     * @param gid
     * @return
     */
    @RequestMapping(value = "/info_audit")
    public String info_audit(ModelMap model, HttpServletRequest request,
                             @RequestParam(value = "id", required = false) Integer id,
                             @RequestParam(value = "gid", required = false) String gid) {
        try {

            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            //获取详情
            WindUpStudyEn WindUpStudyEn = new WindUpStudyEn();
            WindUpStudyEn.setJyId(id);
            WindUpStudyEn.setgID(gid);

            WindUpStudyEn entityInfo = service.queryByPK(WindUpStudyEn);
            model.addAttribute("entity", entityInfo);

            //获取附件信息
            WindUpStudyAttEn att = new WindUpStudyAttEn();
            att.setParentId(entityInfo.getJyId());
            List<WindUpStudyAttEn> attList = WindUpStudyAttrService.queryList(att);
            model.addAttribute("dataList", attList);

            // 获得审批记录信息
            List<WindUpStudyEn> chekResultList = new ArrayList<WindUpStudyEn>();
            String appId = request.getParameter("appId");
            String reId = request.getParameter("reId");
            Integer checkFlag = 0;
            if (!StringUtils.isEmpty(appId)) {
                Client client = AddSoapHeader.validateClient(
                    WsClientUrlConstants.WS_FLOW_FACADE_REMOTE, userEmployee.getUserid());
                if (client != null) {
                    Object[] object = new Object[] { Integer.parseInt(appId), true };
                    Object[] results = client.invoke("GetAdminAuditResults", object);
                    if (results != null && results.length >= 1) {
                        JSONObject jsonObject = (JSONObject) JSON.parse((String) results[0]);
                        if (jsonObject.get("data") != null) {
                            chekResultList = JSON.parseArray(jsonObject.get("data").toString(),
                                WindUpStudyEn.class);
                        }
                    }
                }

                // 获得当前用户是否审批过,根据状态
                if (!StringUtils.isEmpty(reId)) {
                    Object[] object2 = new Object[] { reId };
                    Object[] results2 = client.invoke("GetFlowAuditInfo", object2);
                    if (results2 != null && results2.length >= 1) {
                        JSONObject jsonObject2 = (JSONObject) JSON.parse((String) results2[0]);
                        if (jsonObject2.get("userIsAuditing") != null) {
                            if ((boolean) jsonObject2.get("userIsAuditing") == true) {
                                checkFlag = 1; // 可以审核
                            } else {
                                checkFlag = 0; // 可以审核
                            }
                        }
                    }
                }
            }

            model.put("chekResultList", chekResultList);
            model.put("reId", reId);
            model.put("checkFlag", checkFlag);
            return "xb/JKY_JYPX_JESQ/details_WindUpStudy";
        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("查询 queryByPK [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }

    /**
     * 
     * @Title: index   
     * @Description: 管理端查看审批通过的详细数据
     * @param @param model
     * @param @param request
     * @param @return    参数   
     * @return String    返回类型   
     * @throw
     */
    @RequestMapping(value = "/index_audit_manage")
    public String index_audit_manage(ModelMap model, HttpServletRequest request) {
        request.setAttribute("msg", BaseController.getParameter("msg"));
        BaseController.removeParameter("msg");

        //获取年份list
        List<Map<String, Object>> yearList = service.queryAllYearList();
        request.setAttribute("yearList", yearList);

        //获取部门list
        List<Map<String, Object>> deptList = service.queryAllDeptList();
        request.setAttribute("deptList", deptList);

        //获取组织list
        List<Map<String, Object>> orgList = service.queryAllOrgList();
        request.setAttribute("orgList", orgList);
        return "xb/JKY_JYPX_JESQ/list_WindUpStudy_audit_manage";
    }

    /**
     * 
     * @Title: exportPartyIncorrupt   
     * @Description: 列表数据导出
     * @param @param request
     * @param @param response
     * @param @param data
     * @param @param model
     * @param @return
     * @param @throws Exception    参数   
     * @return String    返回类型   
     * @throws
     */
    @RequestMapping(value = "/exportWindUpStudy")
    public @ResponseBody String exportWindUpStudy(HttpServletRequest request,
                                                  HttpServletResponse response,
                                                  PartyIncorruptEn data,
                                                  ModelMap model) throws Exception {
        try {
            Map<String, Object> map = new HashMap<>();
            String ksId = request.getParameter("ksId");
            if (!StringUtils.isEmpty(ksId)) {
                map.put("ksId", ksId);
            }

            String tgId = request.getParameter("tgId");
            if (!StringUtils.isEmpty(tgId)) {
                map.put("tgId", tgId);
            }

            String empId = request.getParameter("empId");
            if (!StringUtils.isEmpty(empId)) {
                map.put("empId", empId);
            }

            String xm = request.getParameter("xm");
            if (!StringUtils.isEmpty(xm)) {
                map.put("xm", xm.trim());
            }

            String jyNf = request.getParameter("jyNf");
            if (!StringUtils.isEmpty(jyNf)) {
                map.put("jyNf", jyNf);
            }

            String states = request.getParameter("states");
            if (!StringUtils.isEmpty(states)) {
                map.put("states", states);
            }

            String startTime = request.getParameter("startTime");
            if (!StringUtils.isEmpty(startTime)) {
                map.put("startTime", startTime);
            }

            String endTime = request.getParameter("endTime");
            if (!StringUtils.isEmpty(endTime)) {
                map.put("endTime", endTime);
            }

            Page page = new Page();
            page.setCurrPage(1);
            page.setPageSize(999999);
            BaseController.setSortByColumn(request, "createtime", "desc");
            map.put("orderField", (String) request.getAttribute("orderField"));
            map.put("orderFlag", (String) request.getAttribute("orderFlag"));
            List<Map<String, Object>> queryList = service.exportDataList(map, page);

            String[][] title_name = { { "姓名", "工号", "部门", "教研组", "年份", "结业开始日期", "结业结束日期", "学分结构",
                                        "总有效学分" } };
            String[] title_style = { "hwzs_16_bold_25", "kt_12_bold_18", "st_12_r_20", "st_12_n_20",
                                     "st_12_n_20", "st_12_n_20", "st_12_n_20", "st_12_n_20",
                                     "st_12_n_20" };
            String fileName = "管理端查看审批通过的详细数据";
            String[] remark = { "" };
            List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
            if (queryList != null && !queryList.isEmpty()) {
                for (Map<String, Object> res : queryList) {
                    Map<String, Object> map2 = new LinkedHashMap<String, Object>();
                    map2.put("xm", res.get("xm"));
                    map2.put("zgh", res.get("zgh"));
                    map2.put("ksMc", res.get("ksMc"));
                    map2.put("jyzMc", res.get("jyzMc"));

                    map2.put("jyNfYear", res.get("jyNfYear"));
                    map2.put("ksRq", res.get("ksRq"));
                    map2.put("jsRq", res.get("jsRq"));
                    map2.put("xfJg", res.get("xfJg"));
                    map2.put("zyxXf", res.get("zyxXf"));
                    list.add(map2);
                }
            }
            HSSFWorkbook wb = ExpExcelUtil.getWorkBookExcel(title_name, title_style, 100, remark,
                fileName, list);

            try {
                String filenameConvert = "管理端查看审批通过的详细数据";
                new String(fileName.getBytes("GB2312"), "ISO8859-1");
                response.reset();
                response.setContentType("application/vnd.ms-excel;charset=utf-8");
                response.setHeader("Content-Disposition",
                    "attachment;filename=" + new String((filenameConvert + ".xls").getBytes(),
                        "iso-8859-1"));
                response.setDateHeader("Expires", 0);
                ServletOutputStream os = response.getOutputStream();
                wb.write(os);
                os.flush();
            } catch (Exception e) {
                System.out.println("网络连接断开，可能用户取消了导出");
                model.addAttribute(Constant.EXPTION_MSG_KEY, e);
                return "error/error";
            }
        } catch (RPCException e) {
            LOGGER.error("获得管理端查看审批通过的详细数据 exportStudentjobList [{}] error,"
                         + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
        return null;
    }

    /**
     * 审批流程接口List
     * 
     * @param model
     * @param request
     * @param pageSize
     * @param currentPage
     * @param data
     * @return
     */
    @RequestMapping(value = "/list_manage")
    @ResponseBody
    public ResponseResult list_audit(ModelMap model, HttpServletRequest request,
                                     @RequestParam(value = "rows", required = false) String pageSize,
                                     @RequestParam(value = "page", required = false) String currentPage,
                                     WindUpStudyEn data) {
        /*   try {
            Map<String, Object> map = new HashMap<>();
        
            Page page = new Page();
            page.setCurrPage(currentPage == null ? 0 : Integer.valueOf(currentPage));
            page.setPageSize(pageSize == null ? Constant.PageSize : Integer.valueOf(pageSize));
            BaseController.setSortByColumn(request, "createtime", "desc");
            map.put("orderField", (String) request.getAttribute("orderField"));
            map.put("orderFlag", (String) request.getAttribute("orderFlag"));
            PaginationBean<Map<String, Object>> paginationBean = service.queryUserAllAuditData(map,
                page);
            ResponseResult result = new ResponseResult();
            result.setTotal(paginationBean.getTotalRecords());
            result.setRows(paginationBean.getPageList());
        
        
        
        
        
            return result;
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return null;*/

        if (data.getDdlStepState() == null || data.getDdlStepState().equals("")) {
            data.setDdlStepState("2");
        } else if (data.getDdlStepState() != null && data.getDdlStepState().equals("-1")) {
            data.setDdlStepState(null);
        }

        if (data.getDdlUserState() == null || data.getDdlUserState().equals("")) {
            data.setDdlUserState("0");
        } else if (data.getDdlUserState() != null && data.getDdlUserState().equals("-1")) {
            data.setDdlUserState(null);
        }

        Integer loginType = (Integer) request.getSession().getAttribute(Constant.LOGIN_USER_TYPE);
        try {
            ResponseResult result = new ResponseResult();
            List<WindUpStudyEn> pageList = new ArrayList<WindUpStudyEn>();
            int totalRecords = 0;
            if (loginType == 2) { // 老师
                UserEmployee userEmployee = (UserEmployee) request.getSession()
                    .getAttribute(Constant.LOGIN_CONSOLE_USER);
                String params = validateQueryParams(data);

                Client client = AddSoapHeader.validateClient(
                    WsClientUrlConstants.WS_FLOW_FACADE_REMOTE, userEmployee.getUserid());
                if (client != null) {
                    Page page = BaseController.getPage(currentPage, pageSize, request,
                        "reSubmitTime", "desc");
                    Object[] object = new Object[] { WsClientUrlConstants.JYGL_JYSQ_JYSQSP_CELL_ID,
                                                     page.getCurrPage(), page.getPageSize(), params,
                                                     (String) request.getAttribute(
                                                         "orderField") + " " + (String) request
                                                             .getAttribute("orderFlag") };
                    Object[] results = client.invoke("GetUserAuditFlowData_LowerOrder", object);
                    if (results == null || results.length == 0) {
                        //  BaseController.setParameter("msg", "调用流程中发生了服务器异常");
                    } else {
                        JSONObject jsonObject = (JSONObject) JSON.parse((String) results[0]);
                        if (!"success".equals(jsonObject.get("status"))) {
                            result.setMsg(jsonObject.get("errMsg"));
                        } else {
                            if (jsonObject.get("rowCount") != null) {
                                totalRecords = (int) jsonObject.get("rowCount");
                            }
                            if (jsonObject.get("data") != null) {
                                pageList = JSON.parseArray(String.valueOf(jsonObject.get("data")),
                                    WindUpStudyEn.class);
                                totalRecords = pageList.size();
                            }
                        }
                    }
                    // PaginationBean<ZxjDifficultStudent> paginationBean =
                    // dataService.queryZxjDifficultStudentAuditPageList(data, page);
                    result.setTotal(totalRecords);
                    result.setRows(pageList);
                    return result;
                }
            }

        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return null;
    }

    /**
     * 获得查询条件
     * 
     * @param data
     * @return
     */
    private static String validateQueryParams(WindUpStudyEn data) {
        HashMap<String, Object> conditionDataMapList = new HashMap<String, Object>();
        StringBuilder sb = new StringBuilder(200);
        String paramString = null;
        sb.append("[");
        boolean ok = true;
        if (!StringUtils.isEmpty(data.getDdlStates())) {
            conditionDataMapList.clear();
            conditionDataMapList.put("FieldName", "Sys_ApprovalInfo.flowState");
            conditionDataMapList.put("Value", data.getDdlStates());
            conditionDataMapList.put("NeedQuotes", true); // 是否需要单引号
            sb.append(JsonBinder.toJson(conditionDataMapList)).append(",");
            ok = false;
        }
        if (!StringUtils.isEmpty(data.getDdlStepState())) {
            conditionDataMapList.clear();
            conditionDataMapList.put("FieldName", "Sys_ApprovalInfoStep.stepState");
            conditionDataMapList.put("Value", data.getDdlStepState());
            conditionDataMapList.put("NeedQuotes", true); // 是否需要单引号
            sb.append(JsonBinder.toJson(conditionDataMapList)).append(",");
            ok = false;
        }
        if (!StringUtils.isEmpty(data.getDdlUserState())) {
            conditionDataMapList.clear();
            conditionDataMapList.put("FieldName", "Sys_ApprovalInfoResult.userState");
            conditionDataMapList.put("Value", data.getDdlUserState());
            conditionDataMapList.put("NeedQuotes", true); // 是否需要单引号
            sb.append(JsonBinder.toJson(conditionDataMapList)).append(",");
            ok = false;
        }
        if (!StringUtils.isEmpty(data.getXm())) {
            conditionDataMapList.clear();
            conditionDataMapList.put("FieldName", "xm");
            conditionDataMapList.put("Value", data.getXm());
            conditionDataMapList.put("Operator", "Like");
            sb.append(JsonBinder.toJson(conditionDataMapList)).append(",");
            ok = false;
        }
        if (!StringUtils.isEmpty(data.getZgh())) {
            conditionDataMapList.clear();
            conditionDataMapList.put("FieldName", "zgh");
            conditionDataMapList.put("Value", data.getZgh());
            conditionDataMapList.put("Operator", "Like");
            sb.append(JsonBinder.toJson(conditionDataMapList)).append(",");
            ok = false;
        }

        if (data.getJyNf() != 0) {
            conditionDataMapList.clear();
            conditionDataMapList.put("FieldName", "jynf");
            conditionDataMapList.put("Value", data.getJyNf());
            conditionDataMapList.put("NeedQuotes", true); // 是否需要单引号
            sb.append(JsonBinder.toJson(conditionDataMapList)).append(",");
            ok = false;
        }
        if (data.getKsId() != null && data.getKsId() != 0) {
            conditionDataMapList.clear();
            conditionDataMapList.put("FieldName", "ksid");
            conditionDataMapList.put("Value", data.getKsId());
            conditionDataMapList.put("NeedQuotes", true); // 是否需要单引号
            sb.append(JsonBinder.toJson(conditionDataMapList)).append(",");
            ok = false;
        }
        if (data.getTgId() != null && data.getTgId() != 0) {
            conditionDataMapList.clear();
            conditionDataMapList.put("FieldName", "tgid");
            conditionDataMapList.put("Value", data.getTgId());
            conditionDataMapList.put("NeedQuotes", true); // 是否需要单引号
            sb.append(JsonBinder.toJson(conditionDataMapList)).append(",");
            ok = false;
        }

        if (!StringUtils.isEmpty(data.getStartTime())) {
            conditionDataMapList.clear();
            conditionDataMapList.put("FieldName", "createTime");
            conditionDataMapList.put("Value", data.getStartTime());
            conditionDataMapList.put("Operator", "LargerEqual");
            conditionDataMapList.put("IsDateField", true);
            conditionDataMapList.put("NeedQuotes", false); // 是否需要单引号
            sb.append(JsonBinder.toJson(conditionDataMapList)).append(",");
            ok = false;
        }
        if (!StringUtils.isEmpty(data.getEndTime())) {
            conditionDataMapList.clear();
            conditionDataMapList.put("FieldName", "createTime");
            conditionDataMapList.put("Value", data.getEndTime());
            conditionDataMapList.put("Operator", "LessEqual");
            conditionDataMapList.put("IsDateField", true);
            conditionDataMapList.put("NeedQuotes", false); // 是否需要单引号
            sb.append(JsonBinder.toJson(conditionDataMapList)).append(",");
            ok = false;
        }
        if (ok == true) {
            return paramString;
        } else {
            if (sb.length() >= 2) {
                paramString = sb.substring(0, sb.length() - 1);
            }
            paramString = paramString + "]";
        }
        return paramString;
    }

    /**
     * 结业审批流程提交
     */
    @SysLogger(description = "结业管理信息", moduleName = "结业管理", method = "提交")
    @RequestMapping(value = "/btnSubmit")
    public String btnSubmit(ModelMap model, HttpServletRequest request,
                            @RequestParam(value = "id", required = false) Integer id) {
        Integer loginType = (Integer) request.getSession().getAttribute(Constant.LOGIN_USER_TYPE);
        try {
            if (loginType == 2) { // 教师
                UserEmployee userEmployee = (UserEmployee) request.getSession()
                    .getAttribute(Constant.LOGIN_CONSOLE_USER);
                if (id >= 1) {
                    Client client = AddSoapHeader.validateClient(
                        WsClientUrlConstants.WS_FLOW_FACADE_REMOTE, userEmployee.getUserid());
                    if (client != null) {
                        WindUpStudyEn data = new WindUpStudyEn();
                        data.setJyId(id);
                        data = service.queryByPK(data);
                        HashMap<String, Object> conditionDataMap = new HashMap<String, Object>();

                        conditionDataMap.put("xm", userEmployee.getXm());
                        conditionDataMap.put("zgh", userEmployee.getZgh());
                        conditionDataMap.put("ksid", data.getKsId());
                        conditionDataMap.put("ksmc", data.getKsMc());
                        conditionDataMap.put("tgid", data.getTgId());
                        conditionDataMap.put("jyzmc", data.getJyzMc());
                        conditionDataMap.put("createTime", data.getCreateTime());
                        conditionDataMap.put("jynf", data.getJyNf());

                        Object[] object = new Object[] { WsClientUrlConstants.JYGL_JYSQ_JYSQSP_CELL_ID,
                                                         id + "", true, null,
                                                         JsonBinder.toJson(conditionDataMap) };
                        data.setStates(String.valueOf(FlowApprovalState.state2.getIndex()));
                        int num = service.updateStates(data);
                        if (num >= 1) { // 提交成功
                            Object[] results = client.invoke("SubmitFlow", object);
                            if (results == null || results.length == 0) {
                                data.setStates(String.valueOf(FlowApprovalState.state2.getIndex()));
                                service.updateStates(data);
                                BaseController.setParameter("msg", "调用流程中发生了服务器异常，提交申请信息失败");
                            } else {
                                JSONObject jsonObject = (JSONObject) JSON
                                    .parse((String) results[0]);
                                if (!"success".equals(jsonObject.get("status"))) {
                                    data.setStates(
                                        String.valueOf(FlowApprovalState.state2.getIndex()));
                                    service.updateStates(data);
                                } else {
                                    BaseController.setParameter("msg", "提交成功");
                                }
                            }
                        } else {
                            BaseController.setParameter("msg", "提交失败");
                        }
                    }
                    return "redirect:info?id=" + id;
                }

            } else {
                BaseController.setParameter("msg", "您没权限访问该页面");
                return "redirect:/index";
            }
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
        return null;
    }

    @RequestMapping(value = "/audit")
    @SysLogger(description = "结业管理信息", moduleName = "结业管理信息", method = "审核")
    public String audit(ModelMap model, HttpServletRequest request,
                        @RequestParam(value = "jyId") Integer jyId,
                        @RequestParam(value = "states") Integer states,
                        @RequestParam(value = "reId") Integer reId) {
        Integer loginType = (Integer) request.getSession().getAttribute(Constant.LOGIN_USER_TYPE);
        try {
            if (loginType == 2) { // 老师
                UserEmployee userEmployee = (UserEmployee) request.getSession()
                    .getAttribute(Constant.LOGIN_CONSOLE_USER);
                if (jyId >= 1) {
                    // 审批流程
                    Client client = AddSoapHeader.validateClient(
                        WsClientUrlConstants.WS_FLOW_FACADE_REMOTE, userEmployee.getUserid());
                    WindUpStudyEn data = new WindUpStudyEn();
                    data.setJyId(jyId);
                    boolean bool = false; // 流程是否结束
                    if (client != null) {
                        String spyj = request.getParameter("spyj");
                        Object[] object = new Object[] { reId, states == 3 ? true : false, spyj,
                                                         null };
                        Object[] results = client.invoke("DoAudit", object);
                        if (results != null && results.length >= 1) {
                            JSONObject jsonObject = (JSONObject) JSON.parse((String) results[0]);
                            if (jsonObject.get("success") != null
                                && true == (boolean) jsonObject.get("success")) { // 流程审核通过
                                if (jsonObject.get("flowFinished") != null
                                    && true == (boolean) jsonObject.get("flowFinished")
                                    && jsonObject.get("flowState") != null
                                    && ((Integer) jsonObject.get("flowState"))
                                        .intValue() == (FlowApprovalState.state3.getIndex())
                                            .intValue()) { // 标识流程结束，将数据库状态修改成审核通过
                                    data.setStates(
                                        String.valueOf(FlowApprovalState.state3.getIndex()));
                                    bool = true;
                                } else if (jsonObject.get("flowFinished") != null
                                           && false == (boolean) jsonObject.get("flowFinished")
                                           && jsonObject.get("flowState") != null
                                           && ((Integer) jsonObject.get("flowState"))
                                               .intValue() == (FlowApprovalState.state1.getIndex())
                                                   .intValue()) {
                                    data.setStates(
                                        String.valueOf(FlowApprovalState.state1.getIndex()));
                                    bool = true;
                                } else if (jsonObject.get("flowFinished") != null
                                           && false == (boolean) jsonObject.get("flowFinished")
                                           && jsonObject.get("flowState") != null
                                           && ((Integer) jsonObject.get("flowState"))
                                               .intValue() == (FlowApprovalState.state2.getIndex())
                                                   .intValue()) {
                                    data.setStates(
                                        String.valueOf(FlowApprovalState.state2.getIndex()));
                                    bool = true;
                                } else if (jsonObject.get("flowFinished") != null
                                           && false == (boolean) jsonObject.get("flowFinished")
                                           && jsonObject.get("flowState") != null
                                           && ((Integer) jsonObject.get("flowState"))
                                               .intValue() == (FlowApprovalState.state8.getIndex())
                                                   .intValue()) {
                                    data.setStates(
                                        String.valueOf(FlowApprovalState.state8.getIndex()));
                                    bool = true;
                                } else {
                                    bool = false; // 标识流程审核未结束
                                }
                                if (bool == true) { // 代表流程结束后才能将数据状态更新
                                    int num = service.updateStates(data);
                                    if (num >= 1) {
                                        BaseController.setParameter("msg", "审核成功");
                                    } else {
                                        BaseController.setParameter("msg", "审核失败");
                                    }
                                }
                            } else {
                                BaseController.setParameter("msg", "审核失败");
                            }

                        } else {
                            BaseController.setParameter("msg", "流程服务器异常，未返回结果信息，审核失败");
                        }
                    }
                } else {
                    BaseController.setParameter("msg", "审核的数据不存在");
                }
            } else {
                BaseController.setParameter("msg", "没权限访问该页面");
            }
            return "redirect:index_manage";
        } catch (Exception e) {
            LOGGER.error("老师审核助学金申请信息 audit [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }
}
